<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        (function(){
            var html=document.documentElement;
            var hwidth=html.getBoundingClientRect().width;
            html.style.fontSize=hwidth/16+"px";
        })();
    </script>
    <style>
        body{
            margin:0;
        }
        div{
            float: left;
            box-sizing: border-box;
            width:16rem;
            height: 4rem;
            border:1px solid #000;
        }
        div:nth-of-type(1){
            background-color:red;
        }
        div:nth-of-type(2){
            background-color:blue;
        }
        div:nth-of-type(3){
            background-color:green;
        }
        div:nth-of-type(4){
            background-color:pink;
        }
    </style>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</body>
</html>